﻿using Microsoft.OpenApi.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Swashbuckle.AspNetCore.Swagger {
    public static class SwaggerApi {
        /// <summary>
        /// Swagger分组信息，将进行遍历使用
        /// </summary>
        public static readonly List<SwaggerApiInfo> ApiInfos = new List<SwaggerApiInfo>()
        {
            new SwaggerApiInfo
            {
                UrlPrefix = SwaggerGroupingModel.GROUPNAME_COMM,
                Name = "平台服务",
                OpenApiInfo = new OpenApiInfo
                {
                    Version = "v1",
                    Title = "平台服务",
                    Description =  "平台即服务是指将一个完整的软件研发和部署平台,包括应用设计、应用开发和应用托管,都作为一种服务提供给客户"
                }
            },
            new SwaggerApiInfo
            {
                UrlPrefix = SwaggerGroupingModel.GROUPNAME_USER,
                Name = "用户中心",
                OpenApiInfo = new OpenApiInfo
                {
                    Version = "v1",
                    Title = "用户中心",
                    Description =  "一般说来，大型应用会把授权的逻辑与用户信息的相关逻辑独立成一个应用，称为用户中心"
                }
            }
        };

        /// <summary>
        /// 分组信息
        /// </summary>
        public class SwaggerApiInfo {
            /// <summary>
            /// URL前缀
            /// </summary>
            public string UrlPrefix { get; set; }
            /// <summary>
            /// 名称
            /// </summary>
            public string Name { get; set; }
            public OpenApiInfo OpenApiInfo { get; set; }
        }
    }

    /// <summary>
    /// Swagerr分组模块
    /// </summary>
    public static class SwaggerGroupingModel {
        /// <summary>
        /// 公共数据模块
        /// </summary>
        public const string GROUPNAME_COMM = "comm";
        /// <summary>
        /// 内容管理
        /// </summary>
        public const string GROUPNAME_CONTENT = "content";
        /// <summary>
        /// USER
        /// </summary>
        public const string GROUPNAME_USER = "user";
        /// <summary>
        /// Business
        /// </summary>
        public const string GROUPNAME_BUSINESS = "business";



    }
}
